#ifndef __CH392SPI_H__
#define __CH392SPI_H__

#include "debug.h"

#define CSL GPIO_WriteBit(GPIOA, GPIO_Pin_2, Bit_RESET)
#define CSH GPIO_WriteBit(GPIOA, GPIO_Pin_2, Bit_SET)
#define SPICH392CmdStart() CSL
#define SPIEndCH392Cmd() CSH

void CH392_SPIPort_Init(void);
u8 SPI1_WriteRead(u8 data);
void SPIWriteCH392Cmd(u8 cmd);
void SPIWriteCH392Data(u8 mdata);
u8 SPIReadCH392Data(void);

#endif
